import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		hasLogin: false,
		userid:'',
		openid:'',
		username:'',
		headimg:''
	},
	mutations: {
		login(state, userid,openid,username,headimg) {
			state.userid = userid || '';
			state.openid=openid ||'';
			state.username=username ||'',
			state.headimg= headimg||'',
			state.hasLogin = true;
		},
		logout() {
			state.userid =  '';
			state.openid='';
			state.username='',
			state.headimg='',
			state.hasLogin = false;
		}
	}
})

export default store
